package com.kaka.controller;

import com.kaka.javabean.Teacher;
import com.kaka.service.StudentService;
import com.kaka.serviceimpl.StudentServiceImpl;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebServlet(name = "FindAllServlet", value = "/student")
public class FindAllServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        StudentService studentService=new StudentServiceImpl();
        List<Teacher> teachers = studentService.showAllTeacher();

        PrintWriter writer = response.getWriter();
        writer.println(teachers);
    }
}
